/*
2021-8-17
https://www.acwing.com/problem/content/3810/
*/ 

#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int n,k;
        cin>>n>>k;
        for(int i=0;i<n;i++)
        {
            cout<<(char)('a'+i%k);
        }
        cout<<endl;
    }
    return 0;
}
